package wangwenjun.phase1.reference.guavacache;

import com.google.common.base.MoreObjects;
import lombok.extern.slf4j.Slf4j;

/**
 * @author ChangLiang
 * @date 2020/6/20
 */
@Slf4j
public class Employee {

    /**
     * 模拟用户信息 比如从db中查询出来的 我放到cache里面
     */

    private final String name;
    private final String dept;
    private final String empID;
    private final byte[] data = new byte[1024 * 1024];

    public Employee(String name, String dept, String empID)
    {
        this.name = name;
        this.dept = dept;
        this.empID = empID;
    }

    public String getName()
    {
        return name;
    }

    public String getDept()
    {
        return dept;
    }

    public String getEmpID()
    {
        return empID;
    }

    @Override
    public String toString()
    {
        return MoreObjects.toStringHelper(this)
                .add("Name", this.getName()).add("Department", getDept())
                .add("EmployeeID", this.getEmpID()).toString();
    }

    @Override
    protected void finalize() throws Throwable
    {
       log.info("The name " + getName() + " will be GC.");
    }
}
